package com.gagakuai.engine.impl.pvm.process;

import com.gagakuai.engine.impl.pvm.PvmProcessDefinition;
import com.gagakuai.engine.impl.pvm.PvmProcessElement;

import java.util.HashMap;
import java.util.Map;

/*
 * @program: common-starters
 * @description:
 * @author: houhong
 * @create: 2023-01-02 11:38
 */
public class ProcessElementImpl implements PvmProcessElement {


    private static final long serialVersionUID = 7781672855879852058L;

    protected String id;
    protected ProcessDefinitionImpl processDefinition;
    protected Map<String, Object> properties;

    public ProcessElementImpl(String id, ProcessDefinitionImpl processDefinition) {
        this.id = id;
        this.processDefinition = processDefinition;
    }

    public ProcessElementImpl(String id, ProcessDefinitionImpl processDefinition, Map<String, Object> properties) {
        this.id = id;
        this.processDefinition = processDefinition;
        this.properties = properties;
    }

    @Override
    public String getId() {
        return id;
    }


    @Override
    public Object getProperty(String name) {

        if (null == properties) {
            properties = new HashMap<>();
        }

        return null;
    }

    @Override
    public PvmProcessDefinition getProcessDefinition() {
        return null;
    }

    public void setProperty(String name, Object value) {
        if (properties == null) {
            properties = new HashMap<String, Object>();
        }
        properties.put(name, value);
    }

}